//
// Created by shaowenhan on 2020/4/22.
//

#include "ConfigurableEventListener.h"
#include "Double.h"

TEST(TestIsEqual, IsEqual)
{
    double a = 2.03547415;
    double b = 2.03547428;

    ASSERT_TRUE(isEqual(a, b));
    ASSERT_FALSE(isEqual(a, b, 1e-7));
}

TEST(TestIsZero, IsZero)
{
    ASSERT_TRUE(isZero(0.0));
    ASSERT_FALSE(isZero(0.1));
}

TEST(TestIsZero, IsLessThan)
{
    ASSERT_TRUE(isFirstLessThanSecond(2.777, 2.8));
    ASSERT_FALSE(isFirstLessThanSecond(2.777777777777, 2.777777777778));
}

TEST(TestIsZero, IsLessThanOrEqualTo)
{
    ASSERT_TRUE(isFirstLessThanOrEqualToSecond(2.777, 2.8));
    ASSERT_FALSE(isFirstLessThanOrEqualToSecond(2.78, 2.77));
}

TEST(TestIsZero, IsGreaterThan)
{
    ASSERT_TRUE(isFirstGreaterThanSecond(2.8, 2.7));
    ASSERT_FALSE(isFirstGreaterThanSecond(2.777777777778, 2.777777777777));
}

TEST(TestIsZero, IsGreaterThanOrEqualTo)
{
    ASSERT_TRUE(isFirstGreaterThanOrEqualToSecond(2.8, 2.7));
    ASSERT_FALSE(isFirstGreaterThanOrEqualToSecond(2.77, 2.78));
}

GTEST_API_ int main(int argc, char** argv) {
    testing::InitGoogleTest(&argc, argv);
    initialGTest();
    return RUN_ALL_TESTS();
}
